<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        var twoSum = function(nums, target) {
            let result = [];

            for(let i = 0 ;i < nums.length;i++){
                for(let j = i+1 ;j<nums.length;j++){
                    if(nums[i] + nums[j] === target){
                        result.push(i)
                        result.push(j)
                        return result
                    }
                }
            }
        };
        let nums = [2, 7, 11, 15];
        let target = 9;
        console.log(twoSum(nums,target))
    </script>
</body>
</html>